// Triggers story related popups
// Triggers in-occurrences (camp events)
define([
	'ash',
	'game/GameGlobals',
	'game/GlobalSignals',
	'game/constants/GameConstants',
	'text/Text'
], function (
	Ash, GameGlobals, GlobalSignals, GameConstants, Text) {

	let PlayerEventsSystem = Ash.System.extend({

		constructor: function () { },

		addToEngine: function (engine) {
			this.engine = engine;

			GlobalSignals.add(this, GlobalSignals.gameStateLoadedSignal, this.onGamestateLoaded);
		},

		removeFromEngine: function (engine) {
			GlobalSignals.removeAll(this);
		},

		update: function (time) {
			if (GameGlobals.gameState.isPaused) return;
		},

		slowUpdate: function () {
			if (GameGlobals.gameState.isPaused) return;
		},

		showIntroPopup: function () {
			let intro = "你独自醒来，记忆很少。几乎没有光。你需要一段时间才能看清周围的环境。";
			GameGlobals.uiFunctions.showInfoPopup("漆黑的夜晚", intro, "继续", null, null, true, false);
		},

		onGamestateLoaded: function (hasState) {
			if (!hasState) {
				let sys = this;
				setTimeout(function () {
					sys.showIntroPopup();
				}, 1);
			}
		},

	});

	return PlayerEventsSystem;
});
